package com.cts.controller;

import com.cts.entity.About;
import com.cts.model.vo.Result;
import com.cts.service.AboutService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @projectName: CBlog
 * @package: com.cts.controller
 * @className: AboutController
 * @author: chentongsheng
 * @description: TODO
 * @date: 2023/5/4 22:16
 * @version: 1.0
 */
@RestController
@RequestMapping("about")
public class AboutController {

    @Autowired
    private AboutService aboutService;


    @RequestMapping("/getAboutInfo")
    @ApiOperation("获取关于我信息")
    public Result getAboutInfo(){

        List<About> list = aboutService.list();
        Map<String, String> maps = new HashMap<>();
        for (About about : list) {
            maps.put(about.getNameEn(), about.getValue());
        }

        return Result.ok("查询成功",maps);
    }
}
